package com.butterfly.hotkey.worker.store;


import com.butterfly.hotkey.core.enums.CacheDurationEnum;
import com.butterfly.hotkey.core.model.HotKeyModel;

import java.util.Iterator;
import java.util.List;

/**
 * 暂存hotkey的服务,提供方式供client启动时，获取已热的key
 * 1. redis
 * 2. etcd
 * 3. MappedFile TODO
 * <p>
 * 需要定期删除hotkey
 *
 * @author butterfly
 * @version 1.0
 */
public interface HotkeyStoreService {

    /**
     * 追加key
     * TODO
     *
     * @param hotKeyModel hotKeyModel
     * @param duration    duration
     */
    void append(HotKeyModel hotKeyModel, CacheDurationEnum duration);

    /**
     * 查询APP当前所有hotkey,可用于dashboard查询
     * TODO
     *
     * @param appName appName
     * @return hotkey
     */
    Iterator<List<String>> queryHotkeys(String appName);

}
